using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace hoshimiTestBench
{
    

    public partial class Form1 : Form
    {
        AI ai = new AI();
        float Xfactor;
        float Yfactor;

        public unsafe struct placek
        {
            public fixed byte data[16];
        }
        
        
        

        public bool compareColors(Color r, Color l)
        {
            if (l.R == r.R && l.G == r.G && l.B == r.B && l.A == r.A)
                return true;
            else return false;
        }

        Bitmap map_org = new Bitmap("mapa.png");
        MyBitmap map;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            map = new MyBitmap(map_org, 3, 3);
            this.pictureBox1.Image = map.bitmap;
            ai.MapPointsFromImage(map);
            Xfactor = (float)map.bitmap.Width / (float)pictureBox1.Width;
            Yfactor = (float)map.bitmap.Height / (float)pictureBox1.Height;
        }

        

        private void button1_Click(object sender, EventArgs e)
        {
            ai.processMap();
            ai.connectMapFields();
            ai.drawGraph();
            pictureBox1.Image = ai.mapBmp.bitmap;
            pictureBox1.Invalidate();
        }

        private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
        {

            lblXVal.Text = Convert.ToInt32(e.Location.X * Xfactor).ToString();
            lblYVal.Text = Convert.ToInt32(e.Location.Y * Xfactor).ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            ai.processMap2();
            pictureBox1.Image = ai.mapBmp.bitmap;
            pictureBox1.Invalidate();
        }
    }
}